<template>
  <div class="product-show" :data-id="obj.id" @click="JumpTo(obj.id)">
    <img v-lazy="obj.list_pic_url" alt />
    <p>{{ obj.name }}</p>
    <div>{{ obj.retail_price | money }}</div>
  </div>
</template>

<script>
export default {
  props: ["obj"],
  data() {
    return {
      imgSrc: require("@/assets/tu.png")
    };
  },
  filters: {
    money(val) {
      return "￥" + val.toFixed(2) + "元";
    }
  },
  methods: {
    JumpTo(id) {
      this.$router.push("/productdetail/" + id);
    }
  }
};
</script>

<style lang="less">
.product-show {
  width: 49%;
  text-align: center;
  background: #fff;
  margin-bottom: 10px;

  img[lazy="loading"] {
    width: 184px;
    height: 184px;
  }

  img[lazy="loaded"] {
    width: 100%;
  }
  p {
    margin: 0;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  div {
    height: 40px;
    line-height: 40px;
    color: red;
  }
}
</style>
